from pathlib import Path
import os
import sys

myvalgrind = "" #use your valgrind!!!

mypath = Path(sys.argv[1])
ret = mypath.glob("*_tests")

for ite in ret :
    if os.path.isfile(ite) :
        print("testing" + ite.name) 
        if os.system(myvalgrind + " " + ite.name+ " 2>> ./tests.log") :
            print(ite.name+ " PASS")
        else :
            print("ERROR in test " + ite.name + ": more info in tests/tests.log")
            print("------")
            sys.exit(1)

print("")
